<!-- Da hoan thanh co ban viec comment, tuy nhien co hien tuong bi vo layout va avatar chua hoan chinh 
Chua the phan trangng-->

<?php 
	/*
	 * Trieu: Giup cho viec tuong thich he thong
	 */
	if (isset($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
		die ('Please do not load this page directly. Thanks!');
?>

<?php wp_list_comments('type=comment&callback=answer');?> <!-- Trieu: ham nay chua o functions.php -->


<div class="answer-post" style="margin:0;">
    <div class="wp-pagenavi">		
		<p>
			<?php 
				$args = array(
					'base' => add_query_arg( 'cpage', '%#%' ), 			
					'add_fragment' => '#comments',		
					'echo' => 0, 
					//'total' => 'all', 
					//'mid_size' => 3,
					'end_zize' => 5,
					'type' => 'array',
					'prev_text' => __('Previous'), //Dau gach phia duoi la translate
					'next_text' => __('Next'),
				
				);
		
				$arr = paginate_comments_links( $args );
				
				foreach ($arr as $item){
					echo $item;
				}
			?>
		</p>
	</div>
	
	
</div>


        

 <?php if ('open' == $post->comment_status && $user_ID):?> <!-- #begin if : option cho phep view va userID > 0 -->
	 <!-- Them moi 1 comment -->
	 <div class="answer-post">
	 	<a name="ANSWER_THIS_QUESTION"></a> <!-- Danh dau trang -->
		<p>Answer this question</p>
	</div>
	
	<div id="cancel-comment-reply"> 
      <small><?php cancel_comment_reply_link() ?></small>
    </div>
	
	<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
		 <?php comment_id_fields(); ?> <!-- them vao 1 so hidden field cho form nhap comment -->
		   
		<div class="text-publish">
			<textarea name="comment" id="comment" cols=75 rows=6></textarea>
		</div>
		<input class="publish-btn" type="image" name="sudmit" id="submit" 
				src="<?php echo get_bloginfo('template_directory');?>/images/publish.jpg"
				 value="Submit Comment"/>
		 <?php do_action('comment_form', get_the_ID()); ?>  <!-- Add comment -->
	</form>

<?php endif;?> <!-- //endif -->
        